package com.nightpiter.view;

import com.nightpiter.model.objects.Coordinated;
import com.nightpiter.model.objects.Coordinates;
import com.nightpiter.view.graphics.Point;
import com.nightpiter.view.graphics.PointF;

/**
 * This class provides a two-side conversion between screen pixels and real
 * coordinates
 * 
 * @author Eldar Abusalimov (eldar.abusalimov@gmail.com)
 */
public abstract class Calculator {

	/**
	 * @author Eldar Abusalimov (eldar.abusalimov@gmail.com)
	 */
	public enum Mode {
		POSITION, LOCATION
	}

	/**
	 * Converts a lat/lon (or an abs/ord) pair to an x/y screen-pixel pair.
	 * 
	 * @param coordinates
	 *            The point containing the pair to convert.
	 * @param pointF
	 *            a point where the pixel x/y will be stored.
	 */
	public abstract void convert(Coordinates coordinates, PointF pointF);

	/**
	 * Converts a lat/lon (or an abs/ord) pair to an x/y screen-pixel pair.
	 * 
	 * @param coordinates
	 *            The point containing the pair to convert.
	 * @param point
	 *            a point where the pixel x/y will be stored.
	 */
	public abstract void convert(Coordinates coordinates, Point point);

	/**
	 * Helper for a quick access to coordinated's coordinates
	 * 
	 * @param coordinated
	 * @param pointF
	 */
	public abstract void convert(Coordinated coordinated, PointF pointF);

	/**
	 * Helper for a quick access to station's coordinates
	 * 
	 * @param coordinated
	 * @param point
	 */
	public abstract void convert(Coordinated coordinated, Point point);

	/**
	 * Converts a float-pair to another float-pair.
	 * 
	 * @param coordF
	 *            The point containing the pair to convert.
	 * @param pointF
	 *            a point where the pixel x/y will be stored.
	 */
	public abstract void convert(PointF coordF, PointF pointF);

	/**
	 * Converts a float-pair to an x/y screen-pixel pair.
	 * 
	 * @param coordF
	 *            The point containing the pair to convert.
	 * @param point
	 *            a point where the pixel x/y will be stored.
	 */
	public abstract void convert(PointF coordF, Point point);

	/**
	 * reverse method for converting screen pixels to float-pair
	 * 
	 * @param point
	 * @param coordF
	 */
	public abstract void revert(Point point, PointF coordF);

	/**
	 * reverse method for converting screen pixels to float-pair
	 * 
	 * @param pointF
	 * @param coordF
	 */
	public abstract void revert(PointF pointF, PointF coordF);

	/**
	 * Delegates an appropriate coordinates getter of the coordinated
	 * 
	 * @param coordinated
	 * @return
	 */
	public abstract Coordinates getCoordinates(Coordinated coordinated);

	/**
	 * Calculation mode
	 * 
	 * @return
	 */
	public abstract Mode getMode();

}
